package com.jiang.jixiang.ui.adapter;

import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.jiang.jixiang.R;
import com.jiang.jixiang.bean.MalfunctionFailBean;

public class MalfunctionFailAdapter extends BaseQuickAdapter<MalfunctionFailBean, BaseViewHolder> {
    public MalfunctionFailAdapter() {
        super(R.layout.item_malfunctionfail);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, MalfunctionFailBean bean) {
        ImageView imgItem = holder.findView(R.id.imgItem);
        RelativeLayout rlItemLayout = holder.findView(R.id.rlItemLayout);
        TextView tvItemName = holder.findView(R.id.tvItemName);
        holder.setText(R.id.tvItemName, bean.getName());
        if (bean.isCheck()) {
            //imgItem.setImageResource(R.mipmap.icon_checked);
            rlItemLayout.setBackground(getContext().getDrawable(R.drawable.bg_main_chooseed));
            tvItemName.setTextColor(getContext().getColor(R.color.white));
        } else {
            //imgItem.setImageResource(R.mipmap.icon_check);
            rlItemLayout.setBackground(getContext().getDrawable(R.drawable.bg_main_choose));
            tvItemName.setTextColor(getContext().getColor(R.color.main_color));
        }
    }
}
